void a(vector<TH1 *> &v, TH1 *h){ v.push_back((TH1 *)h); }
void dtdc(){
  TFile *f = new TFile(getenv("TMP1"), "UPDATE");
  TTree *etf = (TTree *)f->Get("etf");
  vector<TH1 *> v;
  // const char *zm = "(dE[0]+0.0045*pdcTaU1[1]+4.47213*beta0-3)>2.5 && (dE[0]+0.0045*pdcTaU1[1]+4.47213*beta0-3)<2.6";

  // --------------------- 2. Wire Id Distribution ------------------------ //
  const char xuv[3] = {'X', 'U', 'V'};
  char hname[64]{}, varexp[512]{}, layer[256]{}, cut[512]{};
  int id = 0;
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 2; k++){
        sprintf(hname, "h%d", ++id);
        sprintf(layer, "dc%d%c%d", i, xuv[j], k);
        sprintf(varexp, "%s.GetT()", layer);
        a(v, new TH1F(hname, varexp, 500, -100., 400.));
        sprintf(cut, "%s.fired()>=2", layer);
        // sprintf(cut, "%s.fired()>=2&&%s", layer, zm);
        // etf->Draw("dc0X0.GetWireId()>>h1(83, -1.5, 81.5)", "", "");
        etf->Project(hname, varexp, cut);
        cout << "Processing " << varexp << "...\r" << flush;
      } // end for over x1-2
    } // end for over x,u,v
  } // end for over dcs
  cout << endl;

  TCanvas *c1 = new TCanvas("c", "1-D Drift Time Distribution for post Mag dcs", 1680, 1050);
  c1->Divide(6, 3);
  for(int i = 0; i < 18; i++){
    c1->cd(i+1); v[i]->Draw();
  } // end for
  // c1->Print("dtdc.pdf");
} // end vis
